package com.zbl.zblproject.core.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;

/**
 * @author youlanqiang
 * @version 1.0
 * @date 2018/10/23
 */
public class TimeUtil {


    public static LocalDateTime parseTime(String time){
        LocalDate startDate = LocalDate.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        LocalDateTime startTime =  LocalDateTime.of(startDate, LocalDateTime.MIN.toLocalTime());
       return startTime;
    }

    public static long parseTimeToInstant(String timeStr){
        LocalDateTime time = parseTime(timeStr);
        return time.toEpochSecond(ZoneOffset.of("+8"));
    }

}
